Skip to main content

Data Types

Ethereal has a number of data types that can be used to store and manipulate data.

Strings

  • Strings are a sequence of characters.
  • They are enclosed in double quotes.

Example:

"Hello, world!" // String

Numbers

  • Numbers are either integers or floating point numbers.

    • Integers are whole numbers.
    • Floating point numbers are numbers with a decimal point.

Example:

1 // Integer
1.0 // Floating point number

Booleans

  • Booleans are either true or false.

Example:

true // Boolean
false //Boolean

Arrays

  • Arrays are a collection of data

  • They are enclosed in square brackets.

  • They can contain any type of data.

  • Arrays can be indexed by their position in the array.

    • Arrays are zero-based.
    • The first element in an array is at index 0.

Example:

[1, 2, 3] // Array
["Hello", "world"] // Array

Objects

  • Objects are a collection of data.
  • They are enclosed in curly braces.
  • They can contain any type of data.
  • Objects can be indexed by their name.

Example:

{
"name": "John",
"age": 30
} // Object